#!/bin/csh -f

set inp = "undefined"
if ($#argv == 1) then
  set inp = $1
endif

if ("$inp" != "-nomodules") then

source /opt/modules/default/init/csh

module unload PrgEnv-cray
module unload PrgEnv-gnu
module unload PrgEnv-intel
module unload PrgEnv-pgi
module load PrgEnv-intel/6.0.5

module unload intel
module load intel/19.0.3.199
module unload gcc
module load gcc/8.2.0

module unload cray-mpich
module unload cray-mpich-abi
module load cray-mpich/7.7.6

module unload cray-hdf5
module unload cray-hdf5-parallel
module unload cray-netcdf
module unload cray-netcdf-hdf5parallel
module unload cray-parallel-netcdf
module load cray-netcdf/4.6.3.2

module unload cray-libsci

module unload craype
module load craype/2.6.2

setenv NETCDF_PATH ${NETCDF_DIR}
setenv OMP_PROC_BIND true
setenv OMP_PLACES threads
limit coredumpsize unlimited
limit stacksize unlimited

endif

setenv ICE_MACHINE_MACHNAME cori
setenv ICE_MACHINE_MACHINFO "Cray XC40 Xeon E5-2698v3 Haswell"
setenv ICE_MACHINE_ENVNAME intel
setenv ICE_MACHINE_ENVINFO "ifort 19.0.3.199 20190206"
setenv ICE_MACHINE_MAKE gmake
setenv ICE_MACHINE_WKDIR $SCRATCH/ICEPACK_RUNS
setenv ICE_MACHINE_INPUTDATA /project/projectdirs/ccsm1/cice-consortium/
setenv ICE_MACHINE_BASELINE $SCRATCH/ICEPACK_BASELINE
setenv ICE_MACHINE_SUBMIT "sbatch "
setenv ICE_MACHINE_ACCT P00000000
setenv ICE_MACHINE_QUEUE "regular"
setenv ICE_MACHINE_TPNODE 32    # tasks per node
setenv ICE_MACHINE_BLDTHRDS 4
setenv ICE_MACHINE_QSTAT "squeue --jobs="
